package com.tod.security.springsecuritydb.mapper;

import com.tod.security.springsecuritydb.entity.UserEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Tod.xie
 * Date: 2018-02-05
 * Time: 10:42
 *
 * @author Tod.xie
 */
@Mapper
@Component
public interface UserMapper {
    @Insert("insert into user(username, password, nickname, roles) values(#{username}, #{password}, #{nickname}, #{roles})")
    int insert(UserEntity userEntity);

    @Select("select * from user where username = #{username}")
    UserEntity selectByUsername(@Param("username") String username);
}
